#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ll long long
#define no cout << "no\n"
#define yes cout << "yes\n"
#define endl "\n"
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while(0)
void err(){cout<<"\n";}
template<class T,class... Ts>
void err(T arg,Ts... args){
cout<<arg<<" ";
err(args...);
}
const int N = 200005;
int n, m, k, m_=0, p[N];
ll f[N], a[N];
void solve() {
cin>>n>>m>>k; a[0]=0;
for(int i = 1; i <= n; i++) { cin>>a[i]; p[i]=0; }
sort(a+1,a+1+n);
// n=k;
for(int i = 1; i <= m; i++) {
int x,y;
cin>>x>>y;
p[x] = max(p[x], y);
}
for(int i = 1; i <= n; i++) a[i] += a[i-1];
for(int i = 1; i <= k; i++)
for(int j = 0; j < i; j++)
f[i] = max(f[i], f[j] + a[j+p[i-j]]-a[j]);
cout << a[k]-f[k] << endl;
}
signed main(){
IOS;
int T=1;
// cin>>T;
while(T--){
solve();
}
return 0;
}
580A- Kefa and First Steps | 1472B- Fair Division |
996A - Hit the Lottery | MSNSADM1 Football |
MATCHES Playing with Matches | HRDSEQ Hard Sequence |
DRCHEF Doctor Chef | 559. Maximum Depth of N-ary Tree |
821. Shortest Distance to a Character | 1441. Build an Array With Stack Operations |
1356. Sort Integers by The Number of 1 Bits | 922. Sort Array By Parity II |
344. Reverse String | 1047. Remove All Adjacent Duplicates In String |
977. Squares of a Sorted Array | 852. Peak Index in a Mountain Array |
461. Hamming Distance | 1748. Sum of Unique Elements |
897. Increasing Order Search Tree | 905. Sort Array By Parity |
1351. Count Negative Numbers in a Sorted Matrix | 617. Merge Two Binary Trees |
1450. Number of Students Doing Homework at a Given Time | 700. Search in a Binary Search Tree |
590. N-ary Tree Postorder Traversal | 589. N-ary Tree Preorder Traversal |
1299. Replace Elements with Greatest Element on Right Side | 1768. Merge Strings Alternately |
561. Array Partition I | 1374. Generate a String With Characters That Have Odd Counts |